{% extends "base.html" %}
{% block bar %}
     <div class="col-md-9" style=  "justify-content: flex-end;">
            <h1 class="page-header">图书管理页面</h1>
            <div class="panel panel-primary">
                <!-- Default panel contents -->
                <div class="panel-heading">图书列表 <i class="fa fa-thumb-tack pull-right"></i></div>
                <div class="panel-body">
                    <div class="row" style="margin-bottom: 15px">
                        <div class="col-md-4">
                            <div class="input-group">
                                <input type="text" class="form-control" placeholder="Search for...">
                                <span class="input-group-btn">
                                    <button class="btn btn-default" type="button">搜索</button>
                                </span>
                            </div><!-- /input-group -->
                        </div><!-- /.col-md-4 -->
                        <div class="col-md-2 pull-right">
                            <a class="btn btn-success" href="/app01/add_book/">新增图书</a>
                        </div>
                </div>
                </div>
    {% endblock %}


{% block main %}
    <div class="container-fluid">
    <div class="row-fluid">
        <div class="span12">
             <table class="table table-hover table-bordered">
                 <thead>
                <tr>
                    <th>序号</th>
                    <th>图书id</th>
                    <th>图书名</th>
                    <th>价格</th>
                    <th>库存</th>
                    <th>卖出数</th>
                    <th>出版社</th>
                    <th>操作</th>
                </tr>
                </thead>
                 <tbody>
                 {% for book_obj in book_obj_list %}
                      <tr>
                    <td> {{ forloop.counter }}</td>
                      <td> {{ book_obj.id }}</td>
                      <td>{{ book_obj.name }}</td>
                      <td> {{ book_obj.price}}</td>
                     <td> {{ book_obj.inventory}}</td>
                     <td> {{ book_obj.sale_num}}</td>
                       <td> {{ book_obj.publisher.name }}</td>
                     <td>
                    <a href="/app01/edit_book/?id={{ book_obj.id }}">修改</a>
                    <a href="/app01/delete_book/?id={{ book_obj.id }}">删除</a>
                </td>
                </tr>
                     {% endfor %}
                </tbody>
            </table>
        </div>
    </div>
</div>
{% endblock %}